package com.iv.durian.cloud.facade.support;

import com.iv.durian.cloud.Content;
import com.iv.durian.cloud.Coverage;
import com.iv.durian.cloud.facade.CoverageFacade;
import com.iv.durian.cloud.service.CoverageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by LiuLin on 2018/6/30 0030.
 */
@Slf4j
@RestController
@RequestMapping("/service/coverage")
public class CoverageFacadeImpl implements CoverageFacade {

    @Autowired
    CoverageService coverageService;
    @Override
    public List<Coverage> list(@PathVariable("type") Integer type) { return coverageService.list(type); }

    @Override
    public Coverage get(@PathVariable("coverageId") Integer coverageId) {
        return coverageService.get(coverageId);
    }

    @Override
    public void add(@RequestBody Coverage coverage) {
        coverageService.add(coverage);
    }

    @Override
    public int remove(@PathVariable("coverageId") Integer coverageId) {
        return coverageService.remove(coverageId);
    }

    @Override
    public int count(@PathVariable("type") Integer type) {
        return coverageService.count(type);
    }

    @Override
    public void update(@RequestBody Coverage coverage) {
        coverageService.update(coverage);
    }

    @Override
    public Content getContent(@PathVariable("coverageId") Integer coverageId) {
        return coverageService.getContent(coverageId);
    }

    @Override
    public void updateContent(@RequestBody Content content) {
        coverageService.updateContent(content);
    }
}
